<template>
  <div class="main">
    <div class="header">
      <div class="epName">
        {{ info.name }}
        <span class="goBack" @click="$router.go(-1)">返回</span>
      </div>
      <ul class="epClassify">
        <li>
          <p>主营部门：</p>
          <p>{{ info.charge }}</p>
        </li>
        <li>
          <p>高校类型：</p>
          <p>{{ info.category }}</p>
        </li>
        <li>
          <p>创办时间：</p>
          <p>{{ info.buildate }}</p>
        </li>
        <li>
          <p>办学性质：</p>
          <p>{{ info.nature }}</p>
        </li>
        <li>
          <p>学校地址：</p>
          <p>{{ info.address }}</p>
        </li>
      </ul>
    </div>
    <div class="main_body">
      <el-tabs v-model="activeName">
        <el-tab-pane label="学校简介" name="introduction">
          <div class="header_title">学校简介</div>
          <div class="detail">
            {{ info.introduct }}
          </div>
        </el-tab-pane>
        <el-tab-pane label="基本信息" name="info">
          <div class="flex-box">
            <div class="map_box">
              <baidu-map
                v-if="activeName == 'info'"
                class="bm-view"
                :center="{ lng: info.jwd.lng, lat: info.jwd.lat }"
                :zoom="15"
                :scroll-wheel-zoom="true"
              >
                <bm-marker
                  :position="{ lng: info.jwd.lng, lat: info.jwd.lat }"
                  :icon="{ url: iconPng, size: { width: 36, height: 41 } }"
                >
                </bm-marker>
              </baidu-map>
            </div>
            <div class="info">
              <div class="header_title">基本信息</div>
              <p><span>学校名称：</span>{{ info.name }}</p>
              <p><span>院校类别：</span>{{ info.clas }}</p>
              <p><span>院校专业：</span>{{ info.major }}</p>
              <p><span>院系设置：</span>{{ info.faculty }}</p>
              <p><span>学校代码：</span>{{ info.ccode }}</p>
              <p><span>创办时间：</span>{{ info.buildate }}</p>
              <p><span>学校特色：</span>{{ info.feature }}</p>
              <p><span>学校地址：</span>{{ info.address }}</p>
              <p><span>学校性质：</span>{{ info.nature }}</p>
              <p><span>研究方向：</span>{{ info.research }}</p>
            </div>
          </div>
          <!-- <div class="height_box"></div> -->
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
import { orgsDetail } from "@api/details";
import BaiduMap from "vue-baidu-map/components/map/Map.vue";
import iconPng from "@img/public/icon-location.png";
export default {
  data() {
    return {
      activeName: "introduction",
      activeMenu: "",
      info: {},
      type: "",
      iconPng: iconPng,
    };
  },
  components: {
    BaiduMap,
  },
  mounted() {
    this.id = parseInt(this.$route.params.id);
    this.type = parseInt(this.$route.params.type);
    this.activeMenu = this.$route.params.activeMenu;
    this.$bus.$emit("setActive", this.activeMenu);
    this.getOrgsDetail(this.id, this.type);
  },
  methods: {
    async getOrgsDetail(id, cateone) {
      let res = await orgsDetail({ id, cateone });
      if (res.code && res.code == 0) {
      } else {
        this.info = res;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  width: 100%;
  height: 100%;
  background: #fff;
  overflow: hidden;
  text-align: left;
  .header {
    box-sizing: border-box;
    width: 100%;
    height: 260px;
    background: url("~@img/public/bg-school.png") no-repeat center;
    padding: 0 210px;
  }
  .main_body {
    width: 100%;
    height: calc(100% - 260px);
  }
}

.epName {
  padding-top: 40px;
  font-size: 40px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #ffffff;
  line-height: 52px;
  span {
    margin-left: 30px;
    display: inline-block;
    width: 70px;
    height: 30px;
    line-height: 30px;
    background: #f89718;
    opacity: 0.8;
    border-radius: 4px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
  }
  .goBack {
    margin-top: 7px;
    float: right;
    width: 100px;
    height: 38px;
    line-height: 38px;
    background: #5889dc;
    font-weight: 400;
    opacity: 1;
  }
}
.epClassify {
  display: flex;
  justify-content: flex-start;

  li {
    padding: 0 60px;
    margin-top: 30px;
    position: relative;
    cursor: pointer;
    &::before {
      position: absolute;
      top: 50%;
      left: 0;
      margin-top: -20px;
      display: block;
      content: "";
      width: 1px;
      height: 40px;
      background: #ffffff;
      opacity: 0.5;
    }
    &:first-of-type {
      padding-left: 0;
      &::before {
        opacity: 0;
      }
    }
    &:last-of-type {
      flex: 1;
    }
    p {
      font-size: 20px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #ffffff;
      line-height: 56px;
      opacity: 0.6;
      white-space: nowrap;
      &:last-child {
        font-size: 22px;
        opacity: 0.9;
      }
    }
  }
}
.header_title {
  margin-top: 30px;
  margin-bottom: 20px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #333333;
}
.detail {
  text-indent: 2em;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  line-height: 32px;
  max-height: 390px;
  overflow-y: auto;
  scrollbar-color: #767ffe #e9f3ff; //滚动条轨道颜色   滚动条滑块的颜色
  scrollbar-width: 6px;
  scrollbar-width: thin; //thin模式下滚动条两端的三角按钮会消失
  // overflow-y: auto;
  &::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
    height: 10px;
  }
  &::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 10px;
    background: linear-gradient(0deg, #767ffe, #79aefe);
  }
  &::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    background: #e9f3ff;
    border-radius: 10px;
  }
}
.flex-box {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  .map_box {
    flex: 0 0 50%;
    margin-top: 30px;
    background: #e6e7e7;
    box-shadow: 0px 0px 9px 0px rgba(189, 189, 189, 0.67);
    border-radius: 10px;
  }
}
.info {
  flex: 0 0 45%;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #666666;
  line-height: 18px;
  p {
    margin-bottom: 10px;
  }
}
.bm-view {
  width: 100%;
  height: 100%;
}

// 选项卡样式修改
/deep/ .el-tabs__nav-scroll {
  padding-left: 210px;
}
/deep/.el-tabs__item {
  padding: 0 60px 0 0;
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  height: 60px;
  line-height: 60px;
}
/deep/.el-tabs__item.is-active {
  font-weight: bold;
  color: #0043b3;
}
/deep/.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  padding-left: 0px;
}
/deep/.el-tabs__active-bar {
  height: 4px;
  background: #0043b3;
}
/deep/ .el-tabs__nav-wrap {
  box-shadow: 0px 2px 6px 0px rgba(4, 0, 0, 0.1);
}
/deep/ .el-tabs__nav-wrap::after {
  height: 0;
}
/deep/.el-tabs__header {
  margin: 0;
}
/deep/ .el-tab-pane {
  width: 100%;
  height: 100%;
}
/deep/.el-tabs {
  height: 100%;
  .el-tabs__content {
    box-sizing: border-box;
    height: calc(100% - 60px);
    padding: 0px 240px 30px;
    scrollbar-color: #767ffe #e9f3ff; //滚动条轨道颜色   滚动条滑块的颜色
    scrollbar-width: 6px;
    scrollbar-width: thin; //thin模式下滚动条两端的三角按钮会消失
    // overflow-y: auto;
    &::-webkit-scrollbar {
      /*滚动条整体样式*/
      width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
      height: 10px;
    }
    &::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      border-radius: 10px;
      background: linear-gradient(0deg, #767ffe, #79aefe);
    }
    &::-webkit-scrollbar-track {
      /*滚动条里面轨道*/
      background: #e9f3ff;
      border-radius: 10px;
    }
  }
}
/deep/ .rel-node-checked {
  box-shadow: 0px 0px 10px #2f48c8;
  animation: none;
}
/deep/ .rel-node-shape-0:hover {
  box-shadow: 0px 0px 10px #2f48c8;
}
/deep/ .rel-node-peel:hover .rel-node {
  box-shadow: 0px 0px 10px #2f48c8;
}

.main .header {
  padding: 0 210px;
}
.height_box {
  height: 30px;
}
.info {
  overflow: auto;
  scrollbar-color: #767ffe #e9f3ff; //滚动条轨道颜色   滚动条滑块的颜色
  scrollbar-width: 6px;
  scrollbar-width: thin; //thin模式下滚动条两端的三角按钮会消失
  // overflow-y: auto;
  &::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
    height: 10px;
  }
  &::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 10px;
    background: linear-gradient(0deg, #767ffe, #79aefe);
  }
  &::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    background: #e9f3ff;
    border-radius: 10px;
  }
}

/*
  *常用电脑尺寸  1680 * 900
  *              1536 * 864
  *              1440 * 900
  *ipad pro      1366 * 1024
  *ipad mini     1024 * 768
  *ipad          1024 * 768
 */
/*分辨率低于1680，采用下面的样式*/
@media screen and (max-device-width: 1680px) {
  .main .header {
    padding: 0 20px;
  }
  /deep/ .el-tabs .el-tabs__content {
    padding: 0px 200px 30px;
  }
  .detail {
    max-height: 354px;
  }
}
/*分辨率低于1536，采用下面的样式*/
@media screen and (max-device-width: 1536px) {
  .detail {
    max-height: 296px;
  }
}
/*分辨率低于1440，采用下面的样式*/
@media screen and (max-device-width: 1440px) {
  .detail {
    max-height: 354px;
  }
}
/*分辨率低于1366，采用下面的样式*/
@media screen and (max-device-width: 1366px) {
  .main .header {
    padding: 0 20px;
  }
  /deep/ .el-tabs .el-tabs__content {
    padding: 0px 200px 30px;
  }
  .detail {
    max-height: 450px;
  }
}
/*分辨率低于1180，采用下面的样式*/
@media screen and (max-device-width: 1180px) {
  .main .header {
    padding: 0 20px;
  }
  .epClassify li p {
    font-size: 16px;
  }
  .epClassify li p:last-child {
    font-size: 18px;
  }
  .epClassify li {
    padding: 0 30px;
  }
  /deep/ .el-tabs__nav-scroll {
    padding-left: 30px;
  }
  /deep/ .el-tabs .el-tabs__content {
    padding: 0 30px 30px;
  }
  .detail[data-v-65c8d7fb] {
    font-size: 14px;
  }
  .info p {
    font-size: 12px;
  }
  .detail {
    max-height: 266px;
  }
}
/*分辨率低于1024，采用下面的样式*/
@media screen and (max-device-width: 1024px) {
  .detail {
    max-height: 230px;
  }
}
</style>
